//
//  MineMessageCell.m
//  copyrightTrading
//
//  Created by 郭子一 on 2020/10/6.
//  Copyright © 2020 郭子一. All rights reserved.
//

#import "MineMessageCell.h"

@interface MineMessageCell ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *dateLab;

@end

@implementation MineMessageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    UIImageView *img = [[UIImageView alloc] init];
    img.image = [UIImage imageNamed:@"MineMessageIcon"];
    [self.contentView addSubview:img];
    [img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(19);
        make.centerY.offset(0);
        make.width.height.mas_equalTo(48);
    }];
    
    self.titleLabel = [UILabel new];
    self.titleLabel.text = @"神秘大咖分享、现金红包等你领， 18:00不见不散！";
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.font = JSS_MEDIUM_FONT(17);
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(img.mas_top);
        make.left.equalTo(img.mas_right).offset(9);
        make.right.offset(-50);
        make.height.mas_equalTo(48);
    }];
    
    self.dateLab = [UILabel new];
    self.dateLab.text = @"2020-08-21 14:35:22";
    self.dateLab.font = JSS_MEDIUM_FONT(11);
    self.dateLab.textColor = RGB_VALUE(0x9A9A9A);
    [self.contentView addSubview:self.dateLab];
    [self.dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(2);
        make.left.equalTo(self.titleLabel.mas_left);
        make.right.offset(-50);
        make.height.mas_equalTo(13);
    }];
    
    UIImageView *rightimg = [[UIImageView alloc] init];
    rightimg.image = [UIImage imageNamed:@"右"];
    [self.contentView addSubview:rightimg];
    [rightimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-27);
        make.centerY.offset(0);
        make.width.mas_equalTo(8);
        make.height.mas_equalTo(12);
    }];
    
    UIView *lineView = [UIView new];
    lineView.backgroundColor = RGB_VALUE(0xDBDBDB);
    [self.contentView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(22);
        make.right.offset(-22);
        make.height.mas_equalTo(1);
        make.bottom.offset(0);
    }];
}

- (void)setDataDic:(NSDictionary *)dataDic
{
    _dataDic = dataDic;
    self.titleLabel.text = dataDic[@"title"];
    self.dateLab.text = dataDic[@"create_at"];
}
@end
